/**
*      author: Y_Yao
*      created: 2024-11-16 18:37:32
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int a = n / 100;
    int b = n / 10;
    b = b % 10;
    int c = n % 10;
    cout << b << c << a << " " << c << a << b << endl;
    return 0;
}